<?
$r = "../";
include "defaults_process.php";

$p = "defaults";
include $r."_header.php";
?>


<p class="text">The settings below will be used as defaults for new monitors.</p>

<form action="<?=$PHP_SELF?>" method="post" name="form_def">
<input type="Hidden" name="do_update" value="1">

<table cellspacing="5" cellpadding="0" border="0" style="margin-left: 5;">
<tr>
	<td colspan="2" class="tdH">General</td>
</tr>
<tr>
	<td><span class="text">Time Zone:</td>
	<td><span class="textStd">
		<?
		$tz = @$account->data["timezone_offset"];
		set_if_null($tz, 0);

		$tz_map = $g_timezone_map;
		if (!isset($tz_map[$tz])) {
			$tz_map[$tz] = timezone_offset_to_string($tz);
			ksort($tz_map);
		}
		?>
		<select name="f_timezone_offset" class="input2" onFocus="this.className='input2_act'" onBlur="this.className='input2'" style="width:450">
		<? html_options_from_map($tz_map, @$account->data["timezone_offset"]); ?>
		</select>
	</td>
</tr>
<tr>
	<td><span class="text">Periodicity:</td>
	<td><span class="textStd"><select name="f_def_frequency" class="input2" onFocus="this.className='input2_act'" onBlur="this.className='input2'" style="width:100">
		<? html_options_from_map($g_monitor_frequency_map, @$account->data["def_frequency"]); ?>
	</td>
</tr>


<tr>
	<td><span class="text">Highlighted Text Color*:</td>
	<td><span class="textStd"><select name="f_def_highlight_font_color" class="input2" onFocus="this.className='input2_act'" onBlur="this.className='input2'"
		onChange="update_hl_ex();" style="width:100">
		<? html_options_from_map($g_hightlight_font_color_map, @$account->data["def_highlight_font_color"]); ?>
		</select>
	</td>
</tr>
<tr>
	<td><span class="text">Highlighted Text Background*:</td>
	<td><span class="textStd"><select name="f_def_highlight_bk_color" class="input2" onFocus="this.className='input2_act'" onBlur="this.className='input2'"
		onChange="update_hl_ex();" style="width:100">
		<? html_options_from_map($g_hightlight_bk_color_map, @$account->data["def_highlight_bk_color"]); ?>
		</select>

		Highlight
        <span id="hl_ex"><span id="hl_ex2">changes</span></span>
        and
        <span id="hl_exi"><span id="hl_exi2">keywords</span></span>

	</td>
</tr>
<tr>
	<td><span class="text">Highlighted Text Style:</td>
	<td><span class="textStd">
	<?
	$v = @$account->data["def_highlight_font_style"];
	foreach ($g_highlight_font_style_map as $k => $name)
	{
		echo '<input type="Checkbox" name="f_hl_fs_'.$k.'" onClick="update_hl_ex();" ';
		html_radio_value($k, $v & $k);
		echo '>'.$name."\n";
	}
	?>
	</td>
</tr>


<script language="javascript" type="text/javascript" src="<?=$r?>js/main.js">
</script>
<script language="javascript" type="text/javascript">
function update_hl_ex()
{
	var f = document.form_def;
	update_highlight_example(
		"hl_ex", "hl_ex2", "hl_exi", "hl_exi2",
		f.f_def_highlight_font_color.value, f.f_def_highlight_bk_color.value,
		f.f_hl_fs_1.checked, f.f_hl_fs_2.checked, f.f_hl_fs_4.checked, f.f_hl_fs_8.checked
	);
}
update_hl_ex();
</script>


<tr>
	<td></td>
	<td><span class="textStd"><input type="Checkbox" name="f_def_disable_top_list_stats"
		<? html_radio_value(1, $account->data["def_disable_top_list_stats"]); ?>>
		Don't include in top list</td>
</tr>

<tr><td colspan="2">&nbsp;</td></tr>
<tr>
	<td colspan="2" class="tdH">Notification</td>
</tr>
<tr>
	<td><span class="text">Format:</td>
	<td colspan="2"><span class="textStd">
		<? $v = @$account->data["def_alert_format"]; ?>
		<input type="Radio" name="f_def_alert_format" <? html_radio_value(ALERT_FORMAT_HTML, $v); ?>>
		HTML
		<input type="Radio" name="f_def_alert_format" <? html_radio_value(ALERT_FORMAT_PLAIN_TEXT, $v); ?>>
		Plain text
	</td>
</tr>
<tr>
	<td valign="top"><span class="text">E-mail(s):</td>
	<td><span class="textStd"><input type="Text" name="f_def_alert_emails" value="<?=htmlspecialchars(@$account->data["def_alert_emails"])?>"
			class="input2" onFocus="this.className='input2_act'" onBlur="this.className='input2'" style="width:230">
		<input type="Button" value="Send test notification" class="button2" onMouseOver="this.className='button2_act'" onMouseOut="this.className='button2'"
			onClick="send_tn();">
		<div id="tn_res"></div>
	</td>
</tr>
<script type="text/javascript" language="JavaScript">
function send_tn()
{
    /* TODO: replace with generic function */
	var s =
		'<table cellspacing="10" cellpadding="0">'+
		'<tr>'+
		'<td><img src="../images/throbber.gif" width="39" height="39" alt="" border="0"></td>'+
		'<td><p class="text" id="tm_action_text">Loading...</td>'+
		'</tr>'+
		'</table>';
	document.getElementById("tn_res").innerHTML = s;

	var f = document.form_def;
	ajaxLoadDataToInnerHtml(
		ajaxAppendToUrl(
			g_site_root_ajax+"/members/defaults_tn.php",
			ajaxFormElementsToUrl(new Array(f.f_def_alert_emails))
		),
		"tn_res");
}
</script>

<tr>
	<td></td>
	<td><span class="textStd">Separate e-mails with commas to alert on several
		addresses simultaneously</span>
	</td>
</tr>
<tr>
	<td><span class="text">SMS:</td>
	<td><span class="textStd"><input type="checkbox" name="f_def_alert_sms" <? html_radio_value(1, $account->data["def_alert_sms"]); ?>">
	&nbsp;check to enable SMS notifications</span>
	</td>
</tr>


<tr><td colspan="2">&nbsp;</td></tr>
<tr>
	<td colspan="2" class="tdH">Display Options</td>
</tr>
<tr>
	<td><span class="text">Monitors to be displayed per page:</td>
	<td><span class="textStd"><select name="f_view_max_size" class="input2" onFocus="this.className='input2_act'" onBlur="this.className='input2'" style="width:100">
		<? html_options_from_list($g_view_max_size_list, @$account->data["view_max_size"]); ?>
		</select>
	</td>
</tr>

</form>



<tr><td colspan="2">&nbsp;</td></tr>
<tr>
	<td colspan="2" class="tdH">Manage Categories</td>
</tr>
<tr>
	<td colspan="2">
<?
include "defaults_ce.php";
?>
	</td>
</tr>


<tr>
	<td colspan="2"><span class="textStd">
		<input type="Submit" value="Save" style="width: 150;" class="button2" onMouseOver="this.className='button2_act'" onMouseOut="this.className='button2'"
			onClick="document.form_def.submit();">
		<input type="Reset" value="Cancel" class="button2" onMouseOver="this.className='button2_act'" onMouseOut="this.className='button2'"
			onClick="document.form_def.reset();">
	</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>

</table>
</form>


<?
include $r."_footer.php";
?>